package thread;

// 使用Lambda表达式

public class Demo5 {
    public static void main(String[] args) {
        Thread thread = new Thread( ()-> { // 啥也不输入，而是直接打印！(不用申明称谢run方法）
            while (true) {
                System.out.println("hello thread!");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }

        } );
        thread.start();

        while (true) {
            System.out.println("hello main");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
